<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>属性和方法-$delete</title>
    <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>
<body>
<div id="case10-demo1">
    名字:{{user.name}}
    年纪:{{user.age}}<br>
    <button v-on:click="addUserAgeField">删除一个年级字段</button>
</div>
<script type="text/javascript">
    var case10Demo1=new Vue({
        el:"#case10-demo1",
        data:{
            user:{
                name:"slsher",
                age:10
            }
        },
        methods:{
            addUserAgeField(){
                //delete this.user,age; 这样是不起作用的 不会触发数据响应式更新
                case10Demo1.$delete(case10Demo1.user,"age")//应该使用
            }
        }
    })
</script>
</body>
</html>